<% form_for @receta do |receta_form| %>
	<%= receta_form.error_messages %>

	<% content_for :jstemplates do -%>
	  <%= "var ingrediente='#{generate_template(receta_form, :ingredientes)}'" %>
  	  <%= "var paso='#{generate_template(receta_form, :pasos)}'" %>
	<% end -%>
  
  <p>
    <%= receta_form.label :titulo %><br />
    <%= receta_form.text_field :titulo %>
  </p>
  <p>
    <%= receta_form.label :entradilla %><br />
    <%= receta_form.text_field :entradilla %>
  </p>
  
  <h2>Ingredientes</h2>
  <div id="ingredientes">
  	<% receta_form.fields_for :ingredientes do |ingrediente_form| %>
  		<%= render :partial => 'ingrediente', :locals => { :f => ingrediente_form } %>
  	<% end %>
  </div>
  <%= link_to 'Mas ingredientes', '#ingrediente', :class => "add_nested_item", :rel => "ingredientes" %>
  
  <h2>Pasos</h2>
  <div id="pasos">
  	<% receta_form.fields_for :pasos do |paso_form| %>
  		<%= render :partial => 'paso', :locals => { :f => paso_form } %>
  	<% end %>
  </div>
  <%= link_to 'Mas pasos', '#paso', :class => "add_nested_item", :rel => "pasos" %>

  <p>
    <%= receta_form.submit receta_form.object.new_record? ? 'Crear' : 'Modificar' %>
  </p>
<% end %>